// axios
import request from '@/utils/request'
import { rsaEncrypt } from '@/utils/rsa'
// 获取验证码图片
export function getImg(id) {
  return request({
    url: '/login/generateCaptcha/' + id,
    method: 'get',
    responseType: 'blob'
  })
}
// 获取图片ID
export function getImgId() {
  return request({
    url: '/login/generateCaptchaId',
    method: 'get'
  })
}

// 验证码校验
export function checkImg(data) {
  return request({
    url: '/login/validateCaptcha',
    method: 'post',
    data
  })
}

export function login(data) {
  return request({
    url: '/login/loginAuth',
    method: 'post',
    data
  })
}

// 获取门店列表
export function getShopList(data) {
  return request({
    url: '/store/select',
    method: 'get',
    params: data
  })
}

// 修改门店详情
export function updateShopDetail(data) {
  const data1 = rsaEncrypt(data);
  return request({
    url: '/store/updateInitialState',
    method: 'put',
    data: {
      data: data1
    }
  })
}